﻿// ===============================================================================
// DotNet.Platform 开发框架 2016 版权所有
// ===============================================================================

using System;
using DotNet.Entity;
using System.ComponentModel.DataAnnotations;

namespace DotNet.JCore.Entity
{
    /// <summary>
    /// 人员信息管理
    /// </summary>
    [Table("人员信息管理")]
    public class Employee
    {
        /// <summary>
        /// 主键
        /// </summary>
        [PrimaryKey]
        [Column("主键", false)]
        public string Id { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [Column("姓名")]
        [Required(ErrorMessage = "请输入姓名")]
        [MaxLength(10, ErrorMessage = "姓名长度不能超过{0}个字符")]
        public string Name { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [Column("手机")]
        [MaxLength(11, ErrorMessage = "手机号码长度不能超过{0}个字符")]
        [RegularExpression("^1[0-9]{10}$", ErrorMessage = "请输入正确的手机号码")]
        public string Phone { get; set; }

        /// <summary>
        /// 部门
        /// </summary>
        [Column("部门")]
        public string Dept { get; set; }

        /// <summary>
        /// 账号主键
        /// </summary>
        [Column("账号主键", false)]
        [Required(ErrorMessage = "请选择账号主键")]
        [MaxLength(50, ErrorMessage = "账号主键长度不能超过{0}个字符")]
        public string UserId { get; set; }

        /// <summary>
        /// 账号
        /// </summary>
        [Column("账号")]
        [Required(ErrorMessage = "请选择账号")]
        [MaxLength(50, ErrorMessage = "账号长度不能超过{0}个字符")]
        public string UserAccount { get; set; }

        /// <summary>
        /// 稽查点主键
        /// </summary>
        [Column("稽查点主键", false)]
        [Required(ErrorMessage = "请选择稽查点主键")]
        [MaxLength(50, ErrorMessage = "稽查点主键长度不能超过{0}个字符")]
        public string PointId { get; set; }

        /// <summary>
        /// 稽查点名称
        /// </summary>
        [Column("稽查点")]
        [Required(ErrorMessage = "请选择稽查点名称")]
        [MaxLength(100, ErrorMessage = "稽查点名称长度不能超过{0}个字符")]
        public string PointName { get; set; }

        /// <summary>
        /// 有效 0无效 1有效
        /// </summary>
        [Column("有效", false)]
        public bool Enabled { get; set; } = true;

        /// <summary>
        /// 有效状态 0无效 1有效
        /// </summary>
        [Ignore]
        [Column("状态")]
        public string EnabledText
        {
            get { return Enabled ? "有效" : "无效"; }
        }

        /// <summary>
        /// 创建用户主键
        /// </summary>
        [Column("创建者主键", false)]
        public string CreateId { get; set; }

        /// <summary>
        /// 创建用户姓名
        /// </summary>
        [Column("创建者姓名")]
        public string CreateName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("创建时间")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 修改用户主键
        /// </summary>
        [Column("修改者主键", false)]
        public string ModifyId { get; set; }

        /// <summary>
        /// 修改用户姓名
        /// </summary>
        [Column("修改者姓名")]
        public string ModifyName { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        [Column("修改时间")]
        public DateTime? ModifyTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Column("备注")]
        [MaxLength(200, ErrorMessage = "备注不能超过200个字符")]
        public string Note { get; set; }

        /// <summary>
        /// 复制对象
        /// </summary>
        public Employee Clone()
        {
            return (Employee)MemberwiseClone();
        }
    }
}
